{% extends "home/common.html" %}
{% block content %}
	<!-- 轮播广告及热门商品 -->

	<div class="container mr-sl mr-sl-1">
		<div class="mr-spotlight mr-spotlight-1  row">
			<!-- 显示轮播广告 -->
			<div
				class=" col-lg-9 col-md-12  col-sm-3 hidden-sm   col-xs-6 hidden-xs ">
				<div class="mr-module module " id="Mod159">
					<div class="module-inner">
						<div class="module-ct">
							<div class="mijoshop">
								<div class="container_oc">
									<div class="slideshow">
										<div id="slidershow" class="nivoSlider">
											<a href="#" class="nivo-imageLink" style="display: block;cursor:default">
												<img src="{{url_for('static',filename='images/banner/img1.png')}}" class="img-responsive"
												style="display: none;">
											</a>
											<a href="#"
												class="nivo-imageLink" style="display: none;cursor:default">
											<img src="{{url_for('static',filename='images/banner/img2.png')}}" class="img-responsive"
												style="display: none;">
											</a>
											<a href="#" class="nivo-imageLink" style="display: none;cursor:default">
												<img src="{{url_for('static',filename='images/banner/img3.png')}}" class="img-responsive"
												style="display: none;">
											</a>
										</div>
									</div>
									<script type="text/javascript">
										//实现调用幻灯片插件轮播广告
										jQuery(document).ready(function() {
											jQuery('#slidershow').nivoSlider();
										});
									</script>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- 显示热门商品 -->
			<div class="col-lg-3  col-md-6 hidden-md   col-sm-3 hidden-sm   col-xs-6 hidden-xs ">
				<div class="mr-module module highlight " id="Mod160">
					<div class="module-inner">
						<h3 class="module-title ">
							<span>热门商品</span>
						</h3>
						<div class="module-ct">
							<div class="mijoshop">
								<div class="container_oc">
									<div class="box_oc">
										<!-- 循环显示热门商品 ：添加两条商品信息-->
										{% for item in hot_goods %}
										<div class="box-product product-grid">
											<div>
												<div class="image">
													<a href="{{url_for('home.goods_detail',id = item.id)}}">
														<img src="{{url_for('static',filename='images/goods/'+item.picture)}}" width="250px">
													</a>
												</div>
												<div class="name">
													<a href="{{url_for('home.goods_detail',id = item.id)}}">{{item.name}}</a>
												</div>
												<!-- 星级评分条 -->
												<div class="rating">
													<span class="fa fa-stack"><i
														class="fa fa-star fa-stack-2x"></i><i
														class="fa fa-star-o fa-stack-2x"></i> </span> <span
														class="fa fa-stack"><i
														class="fa fa-star fa-stack-2x"></i><i
														class="fa fa-star-o fa-stack-2x"></i> </span> <span
														class="fa fa-stack"><i
														class="fa fa-star fa-stack-2x"></i><i
														class="fa fa-star-o fa-stack-2x"></i> </span> <span
														class="fa fa-stack"><i
														class="fa fa-star fa-stack-2x"></i><i
														class="fa fa-star-o fa-stack-2x"></i> </span> <span
														class="fa fa-stack"><i
														class="fa fa-star fa-stack-2x"></i><i
														class="fa fa-star-o fa-stack-2x"></i> </span>
												</div>
												<!-- // 星级评分条 -->
												<!-- 商品价格 -->
												<div class="price">
													<span class="price-new">价格：{{item.current_price}} 元</span>
												</div>
												<!-- // 商品价格 -->
											</div>
										</div>
										{% endfor %}
										<!-- // 循环显示热门商品 ：添加两条商品信息-->
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- // 显示热门商品 -->
		</div>
	</div>
	<!-- //轮播广告及热门商品  -->
	<!-- 最新上架及打折商品展示 -->
	<nav class="container mr-masstop  hidden-sm hidden-xs">
	<div class="custom">
		<div>
			<div class="ja-tabswrap default" style="width: 100%;">
				<div id="myTab" class="container">
					<h3 class="index_h3">
						<span class="index_title">最新上架</span>
					</h3>
					<!-- //最新上架选项卡 -->
					<div class="ja-tab-content ja-tab-content col-6 active"
						style="opacity: 1; width: 100%; visibility: visible;">
						<div class="ja-tab-subcontent">
							<div class="mijoshop">
								<div class="container_oc">
									<div class="row">
										<!-- 循环显示最新上架商品 ：添加12条商品信息-->
										{% for item in new_goods %}
										<div class="product-grid col-lg-2 col-md-3 col-sm-6 col-xs-12">
											<div class="product-thumb transition">
												<div class="actions">
													<div class="image">
														<a href="{{url_for('home.goods_detail',id = item.id)}}">
															<img src="{{url_for('static',filename='images/goods/'+item.picture)}}" alt="{{item.name}}" class="img-responsive">
														</a>
													</div>
													<div class="button-group">
														<!-- <div class="cart">
															<button class="btn btn-primary btn-primary" type="button"
																data-toggle="tooltip"
																onclick='javascript:window.location.href="/cart_add/?goods_id={{item.id}}&number=1"; '
																style="display: none; width: 33.3333%;"
																data-original-title="加入到购物车">
																<i class="fa fa-shopping-cart"></i>
															</button>
														</div> -->

														<div class="cart">
													   <!-- 用于存储该商品已添加次数的隐藏域  -->
														    <input type="hidden" id="addCount_{{item.id}}" value="0" />
														    <button class="btn btn-primary btn-primary" type="button"
														        data-toggle="tooltip"
														        onclick='javascript:
														        // alert(1)
														            // 获取当前商品已添加的次数
														            var addCount = parseInt(document.getElementById("addCount_{{item.id}}").value);
														         // alert(addCount)
														            // 每次点击累加次数
														            addCount++;
														            // 更新隐藏域中的次数值
														            document.getElementById("addCount_{{item.id}}").value = addCount;
														        // alert(addCount)

														            window.location.href="/cart_add/?goods_id={{item.id}}&number=" + addCount; '
														        style="display: none; width: 33.3333%;"
														        data-original-title="加入到购物车">
														        <i class="fa fa-shopping-cart"></i>
														    </button>
														</div>
													</div> 
													
												</div>
												<div class="caption">
													<div class="name" style="height: 40px">
														<a href="{{url_for('home.goods_detail',id = item.id)}}">
															{{item.name}}
														</a>
													</div>
													<p class="price">
														价格：{{item.current_price}}元
													</p>
												</div>
											</div>
										</div>
										{% endfor %}
										
										<!-- //循环显示最新上架商品：添加12条商品信息 -->
									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- //最新上架选项卡 -->
					<!-- 打折商品选项卡 -->
					<h3 class="index_h3"><span class="index_title">打折商品</span></h3>
					<div class="ja-tab-subcontent">
						<div class="mijoshop">
							<div class="container_oc">
								<div class="row">
									<!-- 循环显示打折商品 ：添加12条商品信息-->
									{% for item in sale_goods %}
									<div class="product-grid col-lg-2 col-md-3 col-sm-6 col-xs-12">
										<div class="product-thumb transition">
											<div class="actions">
												<div class="image">
													<a href="{{url_for('home.goods_detail',id = item.id)}}">
														<img src="{{url_for('static',filename='images/goods/'+item.picture)}}"
															 alt="{{item.name}}" class="img-responsive">
													</a>
												</div>
												<div class="button-group">
													<div class="cart">
														<input type="hidden" id="addCount_{{item.id}}" value="0" />
														<button class="btn btn-primary btn-primary" type="button"
															data-toggle="tooltip"
															onclick='javascript:
														        // alert(1)
														            // 获取当前商品已添加的次数
														            var addCount = parseInt(document.getElementById("addCount_{{item.id}}").value);
														         // alert(addCount)
														            // 每次点击累加次数
														            addCount++;
														            // 更新隐藏域中的次数值
														            document.getElementById("addCount_{{item.id}}").value = addCount;
														        // alert(addCount)

														            window.location.href="/cart_add/?goods_id={{item.id}}&number=" + addCount; '
															style="display: none; width: 33.3333%;"
															data-original-title="加入到购物车">
															<i class="fa fa-shopping-cart"></i>
														</button>
													</div>
												</div>
											</div>
											<div class="caption">
												<div class="name" style="height: 40px">
													<a href="{{url_for('home.goods_detail',id = item.id)}}" style="width: 95%">
														{{item.name}}</a>
												</div>
												<div class="name" style="margin-top: 10px">
													<span style="color: #0885B1">分类：</span>{{item.subcat.cat_name}}
												</div>
												<span class="price"> 现价：{{item.current_price}} 元
												</span><br> <span class="oldprice">原价：{{item.original_price}}元
												</span>
											</div>
										</div>
									</div>
									{% endfor %}
									<!-- 循环显示打折商品 ：添加12条商品信息-->
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- //打折商品 选项卡-->
			</div>
		</div>
	</div>
	</nav>
<!-- //版权栏 -->
{% endblock %}

